<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商家管理控制台</title>
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/identify.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/layout.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/account.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/control_index.css" />
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/haidao.offcial.general.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/select.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/haidao.validate.js"></script>
</head>
<body >
<!-- 顶层导航栏 -->
	 <div class="view-topbar">	 
			<div class="topbar-console">
				<div class="tobar-head fl">
					<a href="#" class="topbar-logo fl">
					<span><img src="${pageContext.request.contextPath}/images/logo.png" width="20" height="20"/></span>
					</a>
					<a href="${pageContext.request.contextPath}/pages/index.jsp" class="topbar-home-link topbar-btn text-center fl"><span>商户管理控制台</span></a>
				</div>
			</div>
			<div class="topbar-info">
				<ul class="fr">
					<li class="fl topbar-info-item">
					<div class="dropdown">
						<a href="#" class="topbar-btn">
						<span class="fl text-normal">${sessionScope.saleAccount.saleAccount }</span>
						<span class="icon-arrow-down"></span>
						</a>
						<ul class="dropdown-menu">
							<li><li><a href="${pageContext.request.contextPath}/saleAccount/logout">注销</a></li>
						</ul>
					</div>
					</li>
				</ul>
			</div>
		</div>
<!-- 顶层往下所有内容view-body -->	
		<div class="view-body">
<!-- 左侧导航栏 -->		
			<div class="view-sidebar">
				<div class="sidebar-content">
<!-- 左侧子导航栏 -->				
					<div class="sidebar-nav ">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">权限申请</span>
							</a>
						</div>
						<ul class="sidebar-trans">
						<li>
							<a href="<%=request.getContextPath()%>/sale/infoShow">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_message.png" width="16" height="16" /></b>
								<span class="text-normal">申请入驻</span>
							</a>
						</li>
						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">商品中心</span>
							</a>
						</div>
						<ul class="sidebar-trans">
							<li>
								<a href="${pageContext.request.contextPath}/goods/goods">
									<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_author.png" width="16" height="16" /></b>
									<span class="text-normal">商品管理</span>
								</a>
							</li>
							<li>
								<a href="${pageContext.request.contextPath}/goods/toAdd">
									<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_author.png" width="16" height="16" /></b>
									<span class="text-normal">商品添加</span>
								</a>
							</li>
						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">个人中心</span>
							</a>
						</div>
						<ul class="sidebar-trans">
						<li>
							<a href="${pageContext.request.contextPath}/saleInfo/getSaleInfo">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_order.png" width="16" height="16" /></b>
								<span class="text-normal">个人信息</span>
							</a>
						</li>
						
						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">子账号中心</span>
							</a>
						</div>
						<ul class="sidebar-trans">
						<li>
							<a href="${pageContext.request.contextPath}/babyAccount/newQuery">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_cost.png" width="16" height="16" /></b>
								<span class="text-normal">子账号查询</span>
							</a>
						</li>
						<li>
							<a href="${pageContext.request.contextPath}/babyAccount/toAdd">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_cost.png" width="16" height="16" /></b>
								<span class="text-normal">子账号添加</span>
							</a>
						</li>
						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">订单管理</span>
							</a>
						</div>
						<ul class="sidebar-trans">
						<li>
							<a href="${pageContext.request.contextPath}/saleOrder/saleOrderList">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_gold.png" width="16" height="16" /></b>
								<span class="text-normal">订单查询</span>
							</a>
						</li>
						</ul>
					</div>
				</div>
			</div>
			
		
		
		
		
         <div class="view-product">
<!-- 业务内容标题 -->         
			   <div class="authority-head">
				 <div class="manage-head">
					<h6 class="layout padding-left manage-head-con">订单查询
					</h6>
				</div>
			</div>
			
         <form action="${pageContext.request.contextPath}/saleOrder/saleOrderListCon" method="get" autocomplete="off"  id="my">
<!-- 分配两侧空间 -->
           <div class="basic-info-detail clearfix">
             <div class="real-name-con height-main margin-top-25 clearfix">        
					<p class="content-left-zoon">
					订单状态：
					</p>
			    <div >				
				 <select id="state" name="state">
			      <option value=""></option>
			      <option value="0" <c:if test="${listState==0}">selected</c:if> >未支付订单</option>
			      <option value="1" <c:if test="${listState==1}">selected</c:if> >已支付订单</option>
			    </select>
			   </div>
		     </div>
				 <div class="real-name-con h eight-main margin-top-25 clearfix">        
				  <p class="content-left-zoon">
					 商品名称：
				</p>					
				<input  class="width-main input"  placeholder="按商品名称查询" type="text" name="goodsName"  id="g"   value="${listGoodsName}"/>
				<span id="gName" style="color:red"></span>
			   </div>
	        	    
			
				<div class="real-name-con height-main margin-top-25 clearfix">
					<div class="margin-large-top padding-left text-left ">
						<input type="submit" value="查询" class="submit fl" >
					</div>
				</div></br>	  
          </form> 
					<div class="authority-content" id="tashow">
						<div class="list-content show">
							<div class="offcial-table tr-border margin-big-top clearfix">
								<div class="tr-th clearfix">
									<div class="th w10">
										订单编号
									</div>
									<div class="th w10">
										商品名称
									</div>
									<div class="th w10">
										商品单价
									</div>
									<div class="th w10">
										商品数量
									</div>
									<div class="th w10">
										收货人姓名
									</div>
									<div class="th w10">
										收获地址
									</div>
									<div class="th w15">
										收货人账号
									</div>
									<div class="th w5">
										订单状态
									</div>
								</div>
								
								
								<c:forEach items="${list}" var="em" >
								<div class="tr clearfix border-bottom-none">
									<div class="td w10">
										${em.id}
									</div>
									<div class="td w10">
									<a href="${pageContext.request.contextPath}/saleOrder/goodsInfo?id=${em.goodsId}&valid=${em.valid}" name="goodsName">${em.goodsName}
										<span name="goodsId" style="display:none;">${em.goodsId}</span></a>
										<span name="valid" style="display:none;">${em.valid}</span></a>
									</div>
									<div class="td w10">
										${em.singlePrice}
									</div>
									<div class="td w10">
										${em.num}
									</div>
									<div class="td w10">
										${em.recName}
									</div>
									<div class="td w10">
										${em.recAddress}
									</div>
									<div class="td w15">
										${em.userAccount}
									</div>
									<c:if test="${em.state == 0}">
										<div class="td w5">未完成订单</div>
									</c:if>
									<c:if test="${em.state == 1}">
										<div class="td w5">已完成订单</div>
									</c:if>
								</div>
						</c:forEach>
								
								
							</div>
						</div>
					</div> 
		                           
	    <div class="show-page padding-big-right">
							<div class="page">
								<div class="page">
									<ul class="offcial-page margin-top margin-big-right">
                                        <li>共<em class="margin-small-left margin-small-right">${page.totalPageCount}</em>页</li>
                                        <li>每页显示<em class="margin-small-left margin-small-right">${page.pageSize }</em>条</li>
                                        <li><a class="next disable" onclick="previousPage();">上一页</a></li>
                                        <li></li>
                                        <li><a class="next disable" onclick="nextPage();">下一页</a></li>
                                        <li><span class="fl">第<em class="margin-small-left margin-small-right">${page.pageNow}</em>页</span></li>
                                    </ul>
								</div>
							</div>
						</div>

	    </div>
	  </div>
	</div>
	
<!-- 下拉功能 --> 
      <script>
			$(".sidebar-title").live('click', function() {
				if ($(this).parent(".sidebar-nav").hasClass("sidebar-nav-fold")) {
					$(this).next().slideDown(200);
					$(this).parent(".sidebar-nav").removeClass("sidebar-nav-fold");
				} else {
					$(this).next().slideUp(200);
					$(this).parent(".sidebar-nav").addClass("sidebar-nav-fold");
				}
			});
			
			//当前第几页数据
			var currentPage = ${page.pageNow};
			
			//总页数
			var totalPage = ${page.totalPageCount};
			
			//下一页
			function nextPage() {
				if (currentPage == totalPage) {
					alert("已经是最后一页数据");
					return false;
				} else {
					window.location.href = "${pageContext.request.contextPath }/saleOrder/saleOrderListCon?pageNow="
						+ (currentPage + 1)+"&goodsName=${listGoodsName}&state=${listState}";
				    return true;
				}
			}
			//上一页
			function previousPage() {
				if (currentPage == 1) {
					alert("已经是第一页数据");
					return false;
				} else {
					window.location.href = "${pageContext.request.contextPath }/saleOrder/saleOrderListCon?pageNow="
						+ (currentPage - 1)+"&goodsName=${listGoodsName}&state=${listState}";
				   return true;
				}
			}
			//商品输入校验
			var goodsName=$("#g");	
			goodsName.blur(function(){
				var goodsNameVal=$("#g").val();
				var gName=$("#gName");
				if(goodsNameVal.length>20){
					gName.html("商品名称超长").css({color:"red"});
					goodsName.focus();
				}else gName.html("ok").css({color:"blue"});
			});
		</script>	
</body>
</html>